package com.poptap.base.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;

import com.mongodb.Mongo;

@Configuration
public class MongoConfiguration extends AbstractMongoConfiguration{

	@Value("#{db.host}")
	private String host;

	@Value("#{db.name}")
	private String name;

	@Value("#{db.port}")
	private int port;

	@Override
	public String getDatabaseName() {
		return name;
	}

	@Override
	@Bean
	public Mongo mongo() throws Exception {
		return new Mongo(host, port);
	}
	
	
}
